package com.ktwlsoft.archivemanage.domain.business.repositoryService;

import java.util.List;

import com.ktwlsoft.archivemanage.domain.dao.entity.Department;
import com.ktwlsoft.archivemanage.domain.dao.repository.IDepartmentMapper;
import org.springframework.stereotype.Service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;

/**
 * department--部门业务层接口实现类
 *
 * @author zhuhe on 2019-10-24 14:19:40
 * @version 1.0
 */
@Service
public class DepartmentRepositoryService {
	
	private final IDepartmentMapper departmentMapper;

	public DepartmentRepositoryService(IDepartmentMapper departmentMapper) {
		this.departmentMapper = departmentMapper;
	}

	/**
 	 * 查询分页 on 2019-10-24 14:19:40
 	 * @param pn 第几页
     * @param pageSize 每页多少条
 	 * @param department department
 	 * @return PageInfo<Department>
 	 */
	public PageInfo<Department> findPage(int pn, int pageSize, Department department) {
		PageHelper.startPage(pn,pageSize);
		PageInfo<Department> pageInfo = new PageInfo<Department>(departmentMapper.findList(department));
		return pageInfo;
	}

    /**
	 * 查询集合 on 2019-10-24 14:19:40
	 * @param department department
	 * @return List<Department>
	 */
	public List<Department> findList(Department department) {
		return departmentMapper.findList(department);
	}

    /**
	 * 根据ID查询信息 on 2019-10-24 14:19:40
	 * @param id	主键
	 * @return Department
	 */
	public Department getById(Long id){
		return departmentMapper.getById(id);
	}

   /**
	 * 新增 on 2019-10-24 14:19:40
	 * @param department department
	 * @return int
	 */
	public int insert(Department department){
		return departmentMapper.insert(department);
	}

   /**
	 * 修改 on 2019-10-24 14:19:40
	 * @param department department
	 * @return int
	 */
	public int update(Department department){
		return departmentMapper.update(department);
	}

   /**
	 * 根据id集合批量删除信息 on 2019-10-24 14:19:40
	 * @param departmentArr	主键编号集合
	 * @return int
	 */
	public int deleteByIds(List<Long> departmentArr){
		return departmentMapper.deleteByIds(departmentArr);
	}

   /**
	 * 根据id删除信息 on 2019-10-24 14:19:40
	 * @param id id
	 * @return int
	 */
	public int deleteById(Long id){
		return departmentMapper.deleteById(id);
	}
}
